<template>
  <div class="singer-album">
    <AlbumItem
      v-for="item in hotAlbums"
      :key="item.id"
      :item="item"
      @click.native="toAlbumDetail(item.id)"
    />
  </div>
</template>

<script>
import AlbumItem from "@/components/basics/AlbumItem.vue";

export default {
  components: {
    AlbumItem,
  },
  async created() {
    // 获取专辑列表
    const { id } = this.$route.query;
    const res = await this.axios.get(`/artist/album?id=${id}`);
    this.hotAlbums = res.data.hotAlbums;
  },
  data() {
    return {
      hotAlbums: [],
    };
  },
  methods: {
    // 进入专辑详情
    toAlbumDetail(id) {
      this.$router.push({ path: "/album_detail", query: { id } });
    },
  },
};
</script>

<style scoped>
.singer-album {
  padding: 10px;
}
</style>